<!DOCTYPE html>
<html>
  <head>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
  <meta name="referrer" content="origin">
  <script>
  async_test(function () {
      window.onmessage = this.step_func(function (event) {
          if (event.data.policy === "no-referrer") {
              assert_equals(event.data.referrer, "");
              this.done();
          }
      });
  }, "no-referrer attribute on iframe");
  </script>

  <iframe src="resources/referrer-attr-iframe-target.html#no-referrer"
      referrerpolicy="no-referrer" />

  <script>
  async_test(function () {
      window.onmessage = this.step_func(function (event) {
          if (event.data.policy === "origin-when-crossorigin") {
              assert_equals(event.data.referrer, "http://127.0.0.1:8000/");
              this.done();
          }
      });
  }, "origin-when-crossorigin referrerpolicy attribute on iframe");
  </script>

  <iframe src="resources/referrer-attr-iframe-target.html#origin-when-crossorigin"
      referrerpolicy="origin-when-crossorigin" />

  <script>
  async_test(function () {
      window.onmessage = this.step_func(function (event) {
          if (event.data.policy === "origin") {
              assert_equals(event.data.referrer, "http://127.0.0.1:8000/");
              this.done();
          }
      });
  }, "origin referrerpolicy attribute on iframe");
  </script>

  <iframe src="resources/referrer-attr-iframe-target.html#origin"
      referrerpolicy="origin" />

  <script>
  async_test(function () {
      window.onmessage = this.step_func(function (event) {
          if (event.data.policy === "unsafe-url") {
              assert_equals(event.data.referrer, "http://127.0.0.1:8000/security/referrer-policy-attribute-iframe.html");
              this.done();
          }
      });
  }, "unsafe-url referrerpolicy attribute on iframe");
  </script>

  <iframe src="http://localhost:8000/security/resources/referrer-attr-iframe-target.html#unsafe-url" referrerpolicy="unsafe-url" />
</body>
</html>
